#include "ItemGroup.h"
#include "Defines.h"
#include "Item.h"



ItemGroup::ItemGroup(QObject *parent)
    : AbstractItem(parent)
{
}



ItemGroup::ItemGroup(const int& type, const QString& name, QObject *parent) :
    AbstractItem(parent)
{
    setData(TypeData, type);
    setData(NameData, name);
}



int ItemGroup::fieldCount() const
{
    int ret = AbstractItem::fieldCount();
    foreach (const AbstractItem* item, findChildren<AbstractItem*>())
    {
        int fields = item->fieldCount();
        if (fields <= ret) continue;

        ret = fields;
    }

    return ret;
}



QString ItemGroup::typeName() const
{
    return QString("%1 %2").arg(typeToName(type())).arg(GROUP_NAME);
}


